﻿
@{
    Layout = null;
}

<form id="passwordModifyForm">
    <div class="form-horizontal col-sm-6">
        <div class="form-group">
            <label for="oldPwd" class="control-label col-sm-3">原密码：</label>
            <div class="col-sm-9">
                <input type="password" id="oldPwd" name="oldPwd" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label for="newPwd" class="control-label col-sm-3">新密码：</label>
            <div class="col-sm-9">
                <input type="password" id="newPwd" name="newPwd" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label for="newPwd1" class="control-label col-sm-3">重复新密码：</label>
            <div class="col-sm-9">
                <input type="password" id="newPwd1" name="newPwd1" class="form-control" />
            </div>
        </div>
        <div class="form-group" style="text-align:center;">
            <span class="btn btn-primary formpasswordSubmit">修改</span>
        </div>
    </div>

</form>

<script>
    $(".formpasswordSubmit").click(function () {
        var oldPwd = $("#oldPwd").val();
        if (oldPwd==null||oldPwd==undefined||oldPwd=="") {
            alert("请输入旧密码");
            return false;
        }
        var newPwd = $("#newPwd").val();
        if (newPwd == null || newPwd == undefined || newPwd == "") {
            alert("请输入新密码");
            return false;
        }
        var newPwd1 = $("#newPwd1").val();
        if (newPwd1 == null || newPwd1 == undefined || newPwd1 == "") {
            alert("请输入重复新密码");
            return false;
        }
        if (newPwd == oldPwd) {
            alert("新旧密码不能相同");
            return false;
        }
        if (newPwd!=newPwd1) {
            alert("两次输入的新密码不相同");
            return false;
        }
        $.post("/Member/PasswordModifySave", $("#passwordModifyForm").serialize(), function (data) {
            if (data == "ok") {
                alert("保存成功");
                window.location.href = "/account/login";
            } else {
                if (data.type != 1) {
                    alert(data);
                }
            }

        });

    });
</script>


